package com.hele.sts.action;

import com.hele.sts.dao.QEnterQueueDao;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionContext;

import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class EkListAction
  implements Action
{
  public String execute()
    throws Exception
  {
    ActionContext ctx = ActionContext.getContext();
    Map session = ctx.getSession();
    this.userId = ((String)session.get("userid"));
    this.yhlx = ((String)session.get("yhlx"));
    if ((this.userId == null) || (this.userId.length() < 1))
    {
      setErrorInfo("用户名无效!");
      return "error";
    }
    if ((this.yhlx == null) || (!this.yhlx.equals("2")))
    {
      setErrorInfo("用户类型不正确!");
      return "error";
    }
    logger.debug(this.action);
    if ((this.action.equals("list")) || (this.action == null)) {
      return list();
    }
    return null;
  }
  
  public String list()
  {
    logger.debug(this.userId);
    this.qEnterQueueList = QEnterQueueDao.load(this.userId);
    return "list";
  }
  
  public List getQEnterQueueList()
  {
    return this.qEnterQueueList;
  }
  
  public void setQEnterQueueList(List qEnterQueueList)
  {
    this.qEnterQueueList = qEnterQueueList;
  }
  
  public String getErrorInfo()
  {
    return this.errorInfo;
  }
  
  public void setErrorInfo(String errorInfo)
  {
    this.errorInfo = errorInfo;
  }
  
  public String getAction()
  {
    return this.action;
  }
  
  public void setAction(String action)
  {
    this.action = action;
  }
  
  static Logger logger = LoggerFactory.getLogger(EkListAction.class);
  String userId;
  List qEnterQueueList;
  String errorInfo;
  String action;
  String yhlx;
}
